package com.zfl.controller;

import com.zfl.common.Result;
import com.zfl.service.RegisterService;
import com.zfl.vo.RegisterRequestVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.validation.Valid;

@RestController
@RequestMapping("/auth")
public class RegisterController {

    private final RegisterService registerService;

    // 构造方法注入
    public RegisterController(RegisterService registerService) {
        this.registerService = registerService;
    }

    /**
     * 用户注册接口
     */
    @PostMapping("/register")
    public Result<?> register(@Valid @RequestBody RegisterRequestVO request) {
        return registerService.register(request);
    }
}